Refactoring pattern matching

نویسندگان

  • Meng Wang
  • Jeremy Gibbons
  • Kazutaka Matsuda
  • Zhenjiang Hu
چکیده

Defining functions by pattern matching over the arguments is advantageous for understanding and reasoning, but it tends to expose the implementation of a datatype. Significant effort has been invested in tackling this loss of modularity; however, decoupling patterns from concrete representations while maintaining soundness of reasoning has been a challenge. Inspired by the development of invertible programming, we propose an approach to program refactoring based on a right-invertible language rinv—every function has a right (or pre-) inverse. We show how this new design is able to permit a smooth incremental transition from programs with algebraic datatypes and pattern matching, to ones with proper encapsulation, while maintaining simple and sound reasoning.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Testing the Impact of Pattern-based Ontology Refactoring on Ontology Matching Results

We observe the impact of ontology refactoring, based on detection of name patterns in the ontology structure, on the results of ontology matching. Results of our experiment are evaluated using novel logic-based measures accompanied by an analysis of typical effects. Although the pattern detection method only covers a fraction of ontological errors, there seems to be a measurable effect on the q...

متن کامل

Macrofication: Refactoring by Reverse Macro Expansion

Refactoring is a code transformation performed at development time that improves the quality of code while preserving its observable behavior. Macro expansion is also a code transformation, but performed at compile time, that replaces instances of macro invocation patterns with the corresponding macro body or template. The key insight of this paper is that for each pattern-template macro, we ca...

متن کامل

Supporting Refactoring Activities Using Histories of Program Modification

Refactoring is one of the promising techniques for improving program design by means of program transformation with preserving behavior, and is widely applied in practice. However, it is difficult for engineers to identify how and where to refactor programs, because proper knowledge and skills of a high order are required of them. In this paper, we propose the technique to instruct how and wher...

متن کامل

Solving the TTC Java Refactoring Case with FunnyQT

This paper describes the FunnyQT1 [1, 2] solution of the TTC 2015 Java Refactoring Case [3]. It solves all core and exception tasks with the exception of Extension 3: Detecting Refactoring Conflicts and has been elected as overall winner of the case. The solution project is available on Github2, and it is set up for easy reproduction on a SHARE image3. FunnyQT is a model querying and transforma...

متن کامل

A Generic Visual Language Technique for DSVL Model Refactoring to Patterns

As the popularity of domain-specific visual languages (DSVLs) grows, many concerns have arisen regarding quality assurance and evolvability of their designs (metamodels) as well as their model instances. We address some aspects of automated DSVL model instance modification for quality improvement based on refactoring specifications. We propose a graph transformation based visual language approa...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:
  • Sci. Comput. Program.

دوره 78  شماره 

صفحات  -

تاریخ انتشار 2013